/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.extension;

/**
 * <p>
 *
 *  扩展处理程序一般是一个复杂逻辑服务时提供实现hook的一种通用模式。
 * </p>
 * <p>该模式主要为模块提供扩展点的机制</p>
 * <p>{@link ExtensionHandler} api方法应始终返回ExtensionResultStatusType的实例，并且通常是继承{@link AbstractExtensionHandler}</p>
 * <p>为了将ExtensionHandler与ExtensionManager相关联，每个处理程序应该有一个@PostConstruct覆盖并将其自身关联到管理器：</p>
 * <pre>
 *  {@code
 *    @literal @Resource(name = "extensionManager")
 *    protected ExtensionManager extensionManager;
 *    @literal @PostConstruct
 *    public void init() {
 *       if (isEnabled()) {
 *           extensionManager.registerHandler(this);
 *       }
 *    }
 *  }
 * </pre>
 *
 * @author joewee
 * @version 1.0.0
 * @Date 2017/11/16 15:29
 */
public interface ExtensionHandler {
    /**
     * 获取优先级.
     *
     * @return
     */
    public int getPriority();

    /**
     * 如果为false ExtensionManager将跳过该handler
     *
     * @return
     */
    public boolean isEnabled();
}
